require 'test/unit'
require 'ostruct'
$:.unshift File.dirname(__FILE__) + "/../lib"
$:.unshift File.dirname(__FILE__) + "/.."
require 'common.rb'
require 'window.rb'
require 'action.rb'
require 'ruby_file.rb'

include Evil

module Test
  module Unit
    class TestCase
      def files(name)
        File.dirname(__FILE__)+"/../fixtures/sample_#{name}.rb"
      end

      def init_action(name)
        editor, dialog, window = OpenStruct.new, OpenStruct.new, OpenStruct.new
        window.log_dialog = dialog 
        action = Action.constantize(name).new(editor, window)
        dialog.logged = ""
        def dialog.append(log) self.logged << log end
        return action, editor, dialog
      end
    end
  end
end

